;;; init-eglot.el --- eglot config
;;; Commentary:
;;; Code:

;; language 语言协议框架
(use-package eglot
  :defer t
  :hook (prog-mode .(lambda ()
                      (unless (derived-mode-p
                               'emacs-lisp-mode
                               'lisp-mode
                               'makefile-mode)
                        (eglot-ensure))))
  :hook (eglot-managed-mode . (lambda () (flymake-mode -1)))
  :config
  (add-to-list 'eglot-server-programs '(rustic-mode . ("rust-analyzer")))
  (add-to-list 'eglot-server-programs '(python-mode . ("pyright-langserver" "--stdio")))
  (add-to-list 'eglot-server-programs '((c-mode c++-mode) . ("clangd")))
  (add-to-list 'eglot-server-programs '(lua-mode . ("lua-language-server")))
  (add-to-list 'eglot-server-programs '(dart-mode . ("dart_language_server")))
  )

(provide 'init-eglot)
;;; init-eglot.el ends here
